<template>
  <div class="my">
    <div class="top">
      <div class="top1">
        <div class="left">
          <div class="left-name">
            {{ userInfo.nickname }}
          </div>
          <div class="left-text">
            {{ userInfo.intro }}
          </div>
        </div>
        <img
          class="right"
          @click="goInfo"
          v-if="userInfo.avatar"
          :src="baseUrl + userInfo.avatar"
          alt=""
        />
        <img
          class="right"
          @click="goInfo"
          v-else
          src="@/assets/logo.png"
          alt=""
        />
      </div>
      <ul class="top2">
        <li class="top2-item">
          <div class="num">298</div>
          <div class="txt">累计答题</div>
        </li>
        <li class="top2-item">
          <div class="num">98</div>
          <div class="txt">收藏题目</div>
        </li>
        <li class="top2-item">
          <div class="num">198</div>
          <div class="txt">我的错题</div>
        </li>
        <li class="top2-item">
          <div class="num">76<span>%</span></div>
          <div class="txt">正确率</div>
        </li>
      </ul>
      <div class="top3">
        <myCell
          class="cell"
          title="我的岗位"
          value="董事长"
          icon="&#xe64d;"
        ></myCell>
      </div>
    </div>
    <div class="content">
      <div class="middle">
        <h3 class="middle-title">面经数据</h3>
        <ul class="middle-content">
          <li class="middle-item">
            <div class="item-top">昨日阅读<span>+300</span></div>
            <div class="item-middle">17</div>
            <div class="item-bottom">阅读总数</div>
          </li>
          <li class="middle-item">
            <div class="item-top">昨日阅读<span>+300</span></div>
            <div class="item-middle">297</div>
            <div class="item-bottom">阅读总数</div>
          </li>
          <li class="middle-item">
            <div class="item-top">昨日阅读<span>+300</span></div>
            <div class="item-middle">187</div>
            <div class="item-bottom">阅读总数</div>
          </li>
        </ul>
      </div>
    </div>
    <div class="bottom">
      <myCell title="我的面经分享" :value="21" icon="&#xe655;"></myCell>
      <myCell title="我的消息" :value="98" icon="&#xe656;"></myCell>
      <myCell title="收藏的题库" :value="32" icon="&#xe654;"></myCell>
      <myCell title="收藏的企业" :value="32" icon="&#xe65c;"></myCell>
      <myCell title="我的错题" :value="123" icon="&#xe64f;"></myCell>
      <myCell title="收藏的面试经验" :value="166" icon="&#xe649;"></myCell>
    </div>
  </div>
</template>

<script>
import myCell from './myCell'
import { mapState } from 'vuex'
export default {
  data () {
    return {
      baseUrl: process.env.VUE_APP_URL
    }
  },
  methods:{
    goInfo(){
      this.$router.push('/home/myInfo')
    }
  },
  computed: {
    ...mapState(['userInfo', 'isLogin'])
  },
  components: {
    myCell
  }
}
</script>

<style lang="less" scoped>
.my {
  .top {
    background-color: #b90837;
    padding: 31px @p15 0;
    position: relative;

    .top1 {
      display: flex;
      justify-content: space-between;

      .left {
        flex: 1;

        .left-name {
          font-size: 21px;
          font-family: PingFangSC, PingFangSC-Semibold;
          font-weight: 600;
          text-align: left;
          color: #ffffff;
          line-height: 30px;
          letter-spacing: 0px;
        }

        .left-text {
          opacity: 0.7;
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: left;
          color: #ffffff;
          line-height: 16px;
          letter-spacing: 0px;
        }
      }

      .right {
        width: 50px;
        height: 50px;
        border: 3px solid rgba(255, 255, 255, 0.38);
        border-radius: 50%;
      }
    }

    .top2 {
      margin-top: 28px;
      padding-bottom: 55px;
      display: flex;
      justify-content: space-between;

      .top2-item {
        text-align: center;

        .num {
          font-size: 21px;
          font-family: DINAlternate, DINAlternata-Bold;
          font-weight: 700;
          text-align: center;
          color: #ffffff;
          line-height: 24px;
          letter-spacing: 0px;
          span {
            font-size: 10px;
            font-weight: 400;
          }
        }

        .txt {
          opacity: 0.7;
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: left;
          color: #ffffff;
          line-height: 16px;
          letter-spacing: 0px;
        }
      }
    }

    .top3 {
      position: absolute;
      left: 0;
      bottom: -16px;
      width: 100%;
      padding: 0 @p15;
      .cell {
        border-radius: 10px;
      }
      div {
        height: 55px;
        background-color: #fff;
      }
    }
  }
  .content {
    padding: 27px @p15 0;
    background: #f7f4f5;
    .middle {
      background-color: #ffffff;
      padding: 19px 15px;
    }
    .middle-title {
      display: flex;
      justify-content: start;
      font-size: 14px;
      font-family: PingFangSC, PingFangSC-Semibold;
      font-weight: 600;
      text-align: center;
      color: #181a39;
      line-height: 20px;
      letter-spacing: 0px;
    }
    .middle-content {
      display: flex;
      text-align: center;
      justify-content: space-between;
      .middle-item {
        margin-top: 17px;
        padding-left: 10px;
        .item-top {
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: center;
          color: #b4b4bd;
          line-height: 14px;
          letter-spacing: 0px;
          span {
            color: #00b8d4;
          }
        }
        .item-middle {
          font-size: 22px;
          font-family: DINAlternate, DINAlternate-Bold;
          font-weight: 700;
          text-align: center;
          color: #181a39;
          line-height: 24px;
          letter-spacing: 0px;
          padding: 10px 0 6px;
        }
        .item-bottom {
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: center;
          color: #545671;
          line-height: 16px;
          letter-spacing: 0px;
        }
      }
    }
  }
}
</style>
